/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.sd.entity;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;

import com.jeesite.common.utils.excel.annotation.ExcelField;
import com.jeesite.common.utils.excel.annotation.ExcelFields;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.validation.constraints.NotNull;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 涉密文件日志审计Entity
 * @author ysj
 * @version 2020-07-07
 */
@Table(name="sd_doc_log", alias="a", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="doc_id", attrName="docId", label="来文ID"),
		@Column(name="log_content", attrName="logContent", label="日志内容"),
		@Column(name="log_date", attrName="logDate", label="操作时间"),
		@Column(name="doc_title", attrName="docTitle", label="来文标题", queryType=QueryType.LIKE),
		@Column(name="sec_lvl", attrName="secLvl", label="密级", comment="密级（1：公开 2：内部 3：秘密 4：机密）"),
		@Column(name="doc_full_num", attrName="docFullNum", label="来文文号，如粤密[2020]1号"),
		@Column(name="opt_user_code", attrName="optUserCode", label="操作用户ID"),
		@Column(name="opt_user_name", attrName="optUserName", label="操作用户姓名", queryType=QueryType.LIKE),
		@Column(name="opt_user_policeno", attrName="optUserPoliceno", label="操作用户警号"),
		@Column(name="log_type", attrName="logType", label="日志类型 1", comment="日志类型 1：登记 2：拟办 3：分发 4：销毁"),


},orderBy="a.id DESC"
)
public class DocLog extends DataEntity<DocLog> {
	@Valid
	@ExcelFields({@ExcelField(
			title = "日志内容",
			attrName = "logContent",
			align = ExcelField.Align.CENTER,
			sort = 10,
			words = 40
	),@ExcelField(
			title = "操作时间",
			attrName = "logDate",
			align = ExcelField.Align.CENTER,
			sort = 10,
			dataFormat = "yyyy-MM-dd HH:mm:ss"
			// fieldType = OfficeType.class
	),@ExcelField(
			title = "来文标题",
			attrName = "docTitle",
			align = ExcelField.Align.CENTER,
			sort = 10,
			words = 15
			// fieldType = OfficeType.class
	),@ExcelField(
			title = "密级",
			attrName = "secLvl",
			align = ExcelField.Align.CENTER,
			sort = 10,
			dictType = "recv_sec_lvl"
			// fieldType = OfficeType.class
	),@ExcelField(
			title = "来文文号",
			attrName = "docFullNum",
			align = ExcelField.Align.CENTER,
			sort = 10
			// fieldType = OfficeType.class
	),@ExcelField(
			title = "操作用户编号",
			attrName = "optUserCode",
			align = ExcelField.Align.CENTER,
			sort = 10,
			words = 10
			// fieldType = OfficeType.class
	),@ExcelField(
			title = "操作用户姓名",
			attrName = "optUserName",
			align = ExcelField.Align.CENTER,
			sort = 10
			// fieldType = OfficeType.class
	),@ExcelField(
			title = "操作用户警号",
			attrName = "optUserPoliceno",
			align = ExcelField.Align.CENTER,
			sort = 10
			// fieldType = OfficeType.class
	),@ExcelField(
			title = "日志类型",
			attrName = "logType",
			align = ExcelField.Align.CENTER,
			sort = 10,
			dictType = "sd_log_type"
			// fieldType = OfficeType.class
	)})
	private static final long serialVersionUID = 1L;
	private String docId;		// 来文ID
	private String logContent;		// 日志内容
	private Date logDate;		// 操作时间
	private String docTitle;		// 来文标题
	private String secLvl;		// 密级（1：公开 2：内部 3：秘密 4：机密）
	private String docFullNum;		// 来文文号，如粤密[2020]1号
	private String optUserCode;		// 操作用户ID
	private String optUserName;		// 操作用户姓名
	private String optUserPoliceno;		// 操作用户警号
	private String logType;		// 日志类型 1：登记 2：拟办 3：分发 4：销毁


	public DocLog() {
		this(null);
	}

	public DocLog(String id){
		super(id);
	}
	
	@NotBlank(message="来文ID不能为空")
	@Length(min=0, max=64, message="来文ID长度不能超过 64 个字符")
	public String getDocId() {
		return docId;
	}

	public void setDocId(String docId) {
		this.docId = docId;
	}
	
	@NotBlank(message="日志内容不能为空")
	@Length(min=0, max=1000, message="日志内容长度不能超过 1000 个字符")
	public String getLogContent() {
		return logContent;
	}

	public void setLogContent(String logContent) {
		this.logContent = logContent;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@NotNull(message="操作时间不能为空")
	public Date getLogDate() {
		return logDate;
	}

	public void setLogDate(Date logDate) {
		this.logDate = logDate;
	}
	
	@Length(min=0, max=500, message="来文标题长度不能超过 500 个字符")
	public String getDocTitle() {
		return docTitle;
	}

	public void setDocTitle(String docTitle) {
		this.docTitle = docTitle;
	}
	
	@Length(min=0, max=1, message="密级长度不能超过 1 个字符")
	public String getSecLvl() {
		return secLvl;
	}

	public void setSecLvl(String secLvl) {
		this.secLvl = secLvl;
	}
	
	@Length(min=0, max=100, message="来文文号，如粤密[2020]1号长度不能超过 100 个字符")
	public String getDocFullNum() {
		return docFullNum;
	}

	public void setDocFullNum(String docFullNum) {
		this.docFullNum = docFullNum;
	}
	
	@Length(min=0, max=64, message="操作用户ID长度不能超过 64 个字符")
	public String getOptUserCode() {
		return optUserCode;
	}

	public void setOptUserCode(String optUserCode) {
		this.optUserCode = optUserCode;
	}
	
	@Length(min=0, max=50, message="操作用户姓名长度不能超过 50 个字符")
	public String getOptUserName() {
		return optUserName;
	}

	public void setOptUserName(String optUserName) {
		this.optUserName = optUserName;
	}
	
	@Length(min=0, max=100, message="操作用户警号长度不能超过 100 个字符")
	public String getOptUserPoliceno() {
		return optUserPoliceno;
	}

	public void setOptUserPoliceno(String optUserPoliceno) {
		this.optUserPoliceno = optUserPoliceno;
	}
	
	@NotBlank(message="日志类型 1不能为空")
	@Length(min=0, max=1, message="日志类型 1长度不能超过 1 个字符")
	public String getLogType() {
		return logType;
	}

	public void setLogType(String logType) {
		this.logType = logType;
	}
	
	public Date getLogDate_gte() {
		return sqlMap.getWhere().getValue("log_date", QueryType.GTE);
	}

	public void setLogDate_gte(Date logDate) {
		sqlMap.getWhere().and("log_date", QueryType.GTE, logDate);
	}
	
	public Date getLogDate_lte() {
		return sqlMap.getWhere().getValue("log_date", QueryType.LTE);
	}

	public void setLogDate_lte(Date logDate) {
		sqlMap.getWhere().and("log_date", QueryType.LTE, logDate);
	}
}